Skip to content

feat(observability-lib): support AddPanelToRow to support collapsed rows#1997

Merged
Atrax1 merged 6 commits intomainfrom
PRODCRE-1783-add-support-for-collapsed-row-with-panels-within
Apr 24, 2026
Merged

feat(observability-lib): support AddPanelToRow to support collapsed rows#1997
Atrax1 merged 6 commits intomainfrom
PRODCRE-1783-add-support-for-collapsed-row-with-panels-within

Conversation

@Atrax1
Copy link
Copy Markdown
Contributor

@Atrax1 Atrax1 commented Apr 23, 2026

Summary

  • Add AddPanelToRow method to nest panels inside rows, which are automatically collapsed by the Grafana SDK
  • Refactor panel assembly to buffer all AddRow, AddPanel, and AddPanelToRow operations and replay them during Build()
    using a two-pass approach, ensuring correct ordering when calls are interleaved
  • Remove RowOptions / explicit Collapsed flag — rows are automatically collapsed when panels are added via
    AddPanelToRow
  • Update README with examples for basic dashboards, collapsed rows, and mixed layouts

Test plan

  • Row with a single panel via AddPanelToRow produces a collapsed row with 1 nested panel
  • Row with multiple panels (stat, timeseries, table) via AddPanelToRow produces a collapsed row with 3 nested panels
  • Interleaved AddPanel and AddRow calls preserve insertion order
  • Mixed rows with and without panels: rows without panels stay open, rows with panels are collapsed, all in correct
    order
  • Multiple rows each with their own panels: panels don't leak between rows
  • Row without panels is not collapsed and has empty panels list
  • All existing tests continue to pass (make test)

Copilot AI review requested due to automatic review settings April 23, 2026 19:48
@Atrax1 Atrax1 requested a review from a team as a code owner April 23, 2026 19:48
@Atrax1 Atrax1 self-assigned this Apr 23, 2026
@Atrax1 Atrax1 requested a review from jmank88 April 23, 2026 19:48
@github-actions
Copy link
Copy Markdown

👋 Atrax1, thanks for creating this pull request!

To help reviewers, please consider creating future PRs as drafts first. This allows you to self-review and make any final changes before notifying the team.

Once you're ready, you can mark it as "Ready for review" to request feedback. Thanks!

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 23, 2026

⚠️ API Diff Results - github.com/smartcontractkit/chainlink-common/observability-lib

⚠️ Breaking Changes (2)

grafana (1)
  • RowOptions — 🗑️ Removed
grafana.(*Builder) (1)
  • AddRow — Type changed:
func(
  - string, 
  - ...RowOptions
  + string
)

✅ Compatible Changes (1)

grafana.(*Builder) (1)
  • AddPanelToRow — ➕ Added

📄 View full apidiff report

@Atrax1 Atrax1 requested a review from chudilka1 April 23, 2026 19:49
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds support for creating collapsed Grafana rows by nesting panels inside rows (AddPanelToRow), and refactors dashboard assembly to buffer row/panel operations and replay them during Build() to preserve call order even when interleaved.

Changes:

  • Introduce AddPanelToRow(rowTitle, ...panels) to nest panels under a row (collapsed rows behavior).
  • Refactor dashboard building to buffer AddRow / AddPanel / AddPanelToRow calls and apply them in Build() via a two-pass replay.
  • Update tests and README examples to cover collapsed rows and mixed layouts; remove explicit row-collapsing options.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.

File Description
observability-lib/grafana/builder.go Adds buffering/replay mechanism, row tracking, and AddPanelToRow; removes row options.
observability-lib/grafana/builder_test.go Adds/updates tests for collapsed rows, ordering, and mixed layouts; removes collapsed-row option test.
observability-lib/README.md Documents AddPanel vs AddPanelToRow and provides examples for collapsed and mixed layouts.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread observability-lib/grafana/builder.go
Comment thread observability-lib/grafana/builder.go
Comment thread observability-lib/grafana/builder.go Outdated
Comment thread observability-lib/grafana/builder.go
Comment thread observability-lib/grafana/builder.go
@Atrax1 Atrax1 enabled auto-merge April 23, 2026 20:41
@Atrax1 Atrax1 added this pull request to the merge queue Apr 24, 2026
Merged via the queue into main with commit b1fd6cb Apr 24, 2026
33 of 35 checks passed
@Atrax1 Atrax1 deleted the PRODCRE-1783-add-support-for-collapsed-row-with-panels-within branch April 24, 2026 12:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants